package day16.FanSe.FS03;

import java.lang.reflect.Field;

public class Text4 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException, InstantiationException {
        Class<?> aClass = Class.forName("day16.FanSe.FS03.Student");
        Field field = aClass.getField("name");
        Student student = (Student) aClass.newInstance();
        field.set(student,"王五");
        Field field1 = aClass.getField("gender");
        field1.set(student,"男");
        Field fields = aClass.getDeclaredField("money");
        fields.setAccessible(true);
        fields.set(student,1000);
        System.out.println(student);

    }
}
